package cn.wolfcode.trip.api.controller;

import cn.wolfcode.trip.base.domain.Discuss;
import cn.wolfcode.trip.base.query.DiscussQuery;
import cn.wolfcode.trip.base.service.IDiscussService;
import cn.wolfcode.trip.base.util.JsonResult;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("discusses")
public class DiscussController {

    @Autowired
    private IDiscussService discussService;
    /*
    * 新增评论的接口
    * */
    @PostMapping
    public JsonResult insert(Discuss discuss){
        discussService.insert(discuss);
        return new JsonResult();
    }


    /**
     *根据大评论的id查询底下所有的评论
     */
    @GetMapping("{articelId}")
    public PageInfo query(DiscussQuery qo){
        return discussService.query(qo);
    }


}
